<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('新增巡视记录')" />
	<th:block th:include="include :: select2-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-ncXunshiLogs-add">
			<div class="form-group" hidden="hidden">
				<label class="col-sm-3 control-label">巡视类型：</label>
				<div class="col-sm-8">
					<input id="xsType" name="xsType" class="form-control" value="1" type="text">
				</div>
			</div>
			<div class="form-group" hidden="hidden">
				<label class="col-sm-3 control-label" hidden="hidden">状态：</label>
				<div class="col-sm-8">
					<input id="xsStatus" name="xsStatus" class="form-control"  value="1" type="text">
				</div>
			</div>
			<div class="form-group" hidden="hidden">
				<label class="col-sm-3 control-label">订单id：</label>
				<div class="col-sm-8">
					<input id="orderId" name="orderId" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">圈舍号：</label>
				<div class="col-sm-8">
					<select name="roomNum" class="form-control m-b" th:with="type=${@dict.getType('cow_juanshe_num')}">
						<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
					</select>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">存栏数量：</label>
				<div class="col-sm-8">
					<input id="stockAmount" name="stockAmount" class="form-control" type="number">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">巡视数量：</label>
				<div class="col-sm-8">
					<input id="xsAmount" name="xsAmount" class="form-control" type="number">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">巡视人员：</label>
				<div class="col-sm-8">
					<select id="createBy" name="createBy" class="form-control select2-multiple" >
						<option th:each="user:${users}" th:value="${user.loginName}" th:text="${user.loginName}"></option>
					</select>
				</div>
			</div>



			<div class="form-group">
				<label class="col-sm-3 control-label">巡视时间：</label>
				<div class="col-sm-8">
					<input id="createTime" data-type="datetime" data-format="yyyy-MM-dd HH:mm:ss" name="createTime" required
						   th:value="*{#dates.format(new java.util.Date().getTime(), 'yyyy-MM-dd hh:mm:ss')}" class="form-control"
						   type="text" th:class="time-input">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">备注：</label>
				<div class="col-sm-8">
					<textarea rows="4" name="remark"  class="form-control" type="text"></textarea>
				</div>
			</div>
		</form>
	</div>
    <div th:include="include::footer"></div>
	<th:block th:include="include :: select2-js" />

	<script type="text/javascript">
		var prefix = ctx + "system/ncXunshiLogs/cow"
		$("#form-ncXunshiLogs-add").validate({
            rules: {
                stockAmount: {
                    required: true,
                    digits: true
                },
                xsAmount: {
                    required: true,
                    digits: true
                }
            },
            messages: {
                stockAmount: "存栏数必须为正整数",
                xsAmount: "巡视数必须为正整数"
            },
            focusCleanup: true
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
	            $.operate.save(prefix + "/add", $('#form-ncXunshiLogs-add').serialize());
	        }
	    }
	</script>
</body>
</html>
